/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.delaphone.flocash.web.action;

import com.delaphone.flocash.model.FBanks;
import com.delaphone.flocash.service.BankService;
import com.delaphone.flocash.service.UserService;
import com.opensymphony.xwork2.Action;

/**
 *
 * @author tamdx
 */
public class DeleteBankAction extends BaseAction {

    private UserService userService;
    private BankService bankService;
    private FBanks bank;
    private int id;
    private String message;

    public String index() {
        if (user == null) {
            return Action.ERROR;
        }
        id = Integer.valueOf(request.getParameter("id"));
        bank = bankService.getBankById(id);
        return Action.SUCCESS;
    }

    public String delBank() {
        if (user == null) {
            return Action.ERROR;
        }
        bankService.deleteBank(id);
        setMessage(getText("user.manage_bank.delete.success"));
        return Action.SUCCESS;
    }

    public BankService getBankService() {
        return bankService;
    }

    public void setBankService(BankService bankService) {
        this.bankService = bankService;
    }

    public UserService getUserService() {
        return userService;
    }

    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    public FBanks getBank() {
        return bank;
    }

    public void setBank(FBanks bank) {
        this.bank = bank;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    
}
